/*
 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package java.lang;

import java.io.IOException;

/**
 * Readable是字符的来源。
 * Readable的字符通过CharBuffer对read方法的调用者可用。
 *
 * @since 1.5
 */
public interface Readable {

    /**
     * 尝试将字符读入指定的字符缓冲区。
     * 缓冲区用作字符存储库:
     * 所做的更改仅是put操作的结果。
     * 不执行缓冲区的flip或者rewind。
     *
     * @param cb the buffer to read characters into
     * @return The number of {@code char} values added to the buffer,
     *                 or -1 if this source of characters is at its end
     * @throws IOException if an I/O error occurs
     * @throws NullPointerException if cb is null
     * @throws java.nio.ReadOnlyBufferException if cb is a read only buffer
     */
    public int read(java.nio.CharBuffer cb) throws IOException;
}
